package it.antonio.ilpizze.ioc.util;


public abstract class Matcher<T> {
	
	public abstract boolean match(T t);
	
	public Matcher<T> and(final Matcher<? super T> other){
		return new Matcher<T>() {

			@Override
			public boolean match(T t) {
				return this.match(t) && other.match(t);
			}
		};
	}
	
	public Matcher<T> or(final Matcher<? super T> other){
		return new Matcher<T>() {

			@Override
			public boolean match(T t) {
				return this.match(t) || other.match(t);
			}
		};
	}

}
